class Book{
    private static int num=1;
    private String name;
    private int id;
    private double price;
    private static int totalNum=0;

    public Book(String name,  double price) {
        this.name = name;
        this.id = num++;
        this.price = price;
        totalNum++;
    }
    public String getName(){
        return name;
    }

    public int getId() {
        return id;
    }

    public double getPrice() {
        return price;
    }

    public static int getTotalNum() {
        return totalNum;
    }
}
public class Main {
    public static void main(String[] args) {
        Book[] book=new Book[]{
                new Book("Java程序设计",34.5),
                new Book("数据结构",44.8),
                new Book("C++程序设计",35.0)
        };
        for (Book b : book) {
            System.out.println("书名: " + b.getName() + ", 属号: " + b.getId() + ", 书价: " + b.getPrice());
        }
        System.out.println("图书总册数为："+Book.getTotalNum());
    }
}
